package com.caiyi.financial.nirvana.sms.controller;

import com.caiyi.financial.nirvana.sms.entity.SmsGatewayRecharge;
import com.caiyi.financial.nirvana.sms.querybean.GatewayRechargeQueryBean;
import com.caiyi.financial.nirvana.sms.service.SmsGatewayRechargeService;
import com.youyu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "通道充值管理")
@RestController
@RequestMapping("sms/admin/gatewayRecharge")
public class GatewayRechargeController {

    @Autowired
    private SmsGatewayRechargeService gatewayRechargeService;

    @ApiOperation(value = "添加GatewayRecharge详情", notes = "添加GatewayRecharge详情描述")
    @ApiImplicitParam(name = "smsGatewayRecharge", value = "通道充值", required = true, dataType = "SmsGatewayRecharge")
    @PostMapping("/addGatewayRecharge")
    public Result addGatewayRecharge(@RequestBody SmsGatewayRecharge smsGatewayRecharge) {
        return Result.ok(gatewayRechargeService.addGatewayRecharge(smsGatewayRecharge));
    }

    @ApiOperation(value = "删除GatewayRecharge详情", notes = "删除GatewayRecharge")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "通道充值id", dataType = "int", paramType = "query", required = true)})
    @PostMapping("/deleteGatewayRecharge")
    public Result deleteGatewayRecharge(Integer id) {
        return Result.ok(gatewayRechargeService.deleteGatewayRecharge(id));
    }

    @ApiOperation(value = "更新GatewayRecharge详情", notes = "更新GatewayRecharge")
    @ApiImplicitParam(name = "smsGatewayRecharge", value = "通道充值", required = true, dataType = "SmsGatewayRecharge")
    @PostMapping("/updateGatewayRecharge")
    public Result updateGatewayRecharge(@RequestBody SmsGatewayRecharge smsGatewayRecharge) {
        return Result.ok(gatewayRechargeService.updateGatewayRecharge(smsGatewayRecharge));
    }


    @ApiOperation(value = "根据params查找GatewayRecharge详情", notes = "根据params查找GatewayRecharge详情描述")
    @ApiImplicitParams({@ApiImplicitParam(name = "bean", value = "查找通道充值参数", dataType = "GatewayRechargeQueryBean", paramType = "GatewayRechargeQueryBean"),

    })
    @PostMapping("/getGatewayRechargeByParams")
    public Result getGatewayRechargeByParams(@RequestBody GatewayRechargeQueryBean bean) {
        return Result.ok(gatewayRechargeService.getGatewayRechargeByParams(bean));
    }
}
